from django.urls import path, re_path, include
from web1.views import account
from web1.views import home
from web1.views import project
from web1.views import statistics
from web1.views import wiki
from web1.views import file
from web1.views import setting
from web1.views import issues
from web1.views import dashboard
urlpatterns = [
    path('register/', account.register, name='register'),
    path('login/sms/', account.login_sms, name='login_sms'),
    path('login/', account.login, name='login'),
    path('logout/', account.logout, name='logout'),
    path('image/code/', account.image_code, name='image_code'),
    path('send/sms/', account.send_sms, name='send_sms'),
    path('index/', home.index, name='index'),

    # 项目管理
    path('project/list', project.project_list, name='project_list'),

    re_path(r'project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/', project.project_star, name='project_star'),
    re_path(r'project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/', project.project_unstar, name='project_unstar'),

    re_path(r'manage/(?P<project_id>\d+)/', include([
        path('wiki/', wiki.wiki, name='wiki'),
        path('wiki/add/', wiki.wiki_add, name='wiki_add'),
        path('wiki/catalog/', wiki.wiki_catalog, name='wiki_catalog'),
        re_path(r'wiki/delete/(?P<wiki_id>\d+)/', wiki.wiki_delete, name='wiki_delete'),
        re_path(r'wiki/edit/(?P<wiki_id>\d+)/', wiki.wiki_edit, name='wiki_edit'),
        path('wiki/upload/', wiki.wiki_upload, name='wiki_upload'),

        path('file/', file.file, name='file'),
        path('file/delete/', file.file_delete, name='file_delete'),
        path('cos/credential/', file.cos_credential, name='cos_credential'),
        path('file/post/', file.file_post, name='file_post'),
        re_path(r'file/download/(?P<file_id>\d+)/', file.file_download, name='file_download'),

        path('setting/', setting.setting, name='setting'),
        path('setting/delete/', setting.delete, name='setting_delete'),

        path('issues/', issues.issues, name='issues'),
        re_path(r'issues/detail/(?P<issues_id>\d+)/', issues.issues_detail, name='issues_detail'),
        re_path(r'issues/record/(?P<issues_id>\d+)/', issues.issues_record, name='issues_record'),
        re_path(r'issues/change/(?P<issues_id>\d+)/', issues.issues_change, name='issues_change'),
        path('issues/invite/url/', issues.invite_url, name='invite_url'),

        path('dashboard/', dashboard.dashboard, name='dashboard'),
        path('dashboard/issues/chart/', dashboard.issues_chart, name='issues_chart'),

        path('statistics/', statistics.statistics, name='statistics'),
        path('statistics/priority/', statistics.statistics_priority, name='statistics_priority'),
        path('statistics/project/user/', statistics.statistics_project_user, name='statistics_project_user'),

    ], None)),

    re_path(r'invite/join/(?P<code>\w+)/', issues.invite_join, name='invite_join'),

]
